#ifndef MULTIWIDGET_H
#define MULTIWIDGET_H

#include <QPainter>

#include "adaptivewidgets.h"

struct MRect
{
    bool press;
    bool enter;
    QRectF rect;
};

class MultiWidget : public AWidget
{
    Q_OBJECT
public:
    explicit MultiWidget(int decimal, double step, double min, double max, const QString &suffix, QWidget *parent = nullptr);
public slots:
    void set(const double &value);
signals:
    void valueChanged(double);
protected:

    void paintEvent(QPaintEvent *event) override;

    void wheelEvent(QWheelEvent *event) override;

    void mousePressEvent(QMouseEvent *event) override;

    void mouseReleaseEvent(QMouseEvent *event) override;

    void mouseMoveEvent(QMouseEvent *event) override;
private:
    ALineEdit *edit;
    int m_decimal;
    double m_step;
    const double m_min;
    const double m_max;
    const QString m_suffix;
    bool m_switch;
    double m_value;

    MRect m_upRect;
    MRect m_downRect;
    MRect m_onRect;
    MRect m_offRect;
};

#endif // MULTIWIDGET_H
